//
//  WFLoginRequest.m
//  WisdomFarm
//
//  Created by 心情 on 2017/10/26.
//  Copyright © 2017年 sky. All rights reserved.
//

#import "WFLoginRequest.h"
#import "WFNotficationNames.h"

@implementation WFLoginRequest
@dynamic response;

+ (Class)responseEntityClass {
    return [WFUser class];
}

- (void)setup {
    [super setup];
    self.path = @"LoginUserInfoNew";
}

- (void)startWithBlock:(MZRequestBlock)block {
    MZRequestBlock interruptBlock = ^(WFLoginRequest *request, NSError *error) {
        if (!error && request.response.resultEntity) {
            [WFStore setCurrentUser:request.response.resultEntity];
            [[NSNotificationCenter defaultCenter] postNotificationName:WFNotficationUserDidLogin object:nil];
        }
        block(request, error);
    };
    [super startWithBlock:interruptBlock];
}

@end
